<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <tb-header></tb-header>
      <tb-footer></tb-footer>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      // 局部创建组件
      // 对象里面写的还是选项，跟全局创建组件的第二个参数完全相同

      // 取名只能使用大驼峰了,使用只能用连字符
      const TbHeader = {
        template: `<div>淘宝头部</div>`,
      };

      const TbButton = {
        template: `<button>按钮</button>`,
      };

      const TbFooter = {
        data() {
          return {
            msg: "底部",
          };
        },
        template: `
          <footer>淘宝{{msg}} - <tb-button></tb-button></footer>
        `,
        components: {
          TbButton,
        },
      };

      new Vue({
        el: "#app",
        data: {},
        // 局部创建的组件是需要注册的
        components: {
          // TbHeader: TbHeader,
          TbHeader,
          TbFooter,
        },
      });
    </script>
  </body>
</html>
